% Chakram is a subproject of Hexena - Haskell Executable Analyser
% License:			GPL-3
% Maintainer:		Montez Fitzpatrick
% Stability:		Experimental
% Portability:		GHC
% Module:			Hexena.Data.LoadConfigDirectory.X86

This is the x86 version of the IMAGE_LOAD_CONFIG_DIRECTORY structure.

According to Windows documentation this structure has been characteristically used
to describe features that were overly complex or too large to fit in other headers
like the File or Optional Headers.  Now this structure provides a lot of the handling
for the SEH, Structured Exception Handlers.

Microsoft provides a default SEH via the linker.  But the user can provide a their own
version to handle SEH data.

All image files provide Load Config symbols.

\begin{code}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeOperators #-}
module Hexena.Data.LoadConfigDirectory.X86 (X86(..)) where

import Data.Word
import Data.Label -- Needs 'fclabels

data X86 = X86
    { _size :: Word32					-- ^ unused
	-- | UTC Time
    , _timeDateStamp :: Word32
    , _majorVersion :: Word16			-- ^ Major Version Number
    , _minorVersion :: Word16			-- ^ Minor Version Number
	-- | Global loader flags to clear as the loader starts the process
    , _globalFlagsClear :: Word32
	-- | Global loader flags to start as the loader starts the process
    , _globalFlagsSet :: Word32
    , _critSectDefTimeout :: Word32		-- ^ Default timeout value
    , _deCommitFBThreshd :: Word32		-- ^ Memory that must be freed (Bytes)
    , _deCommitTFThreshd :: Word32		-- ^ Total amount of free memor (Bytes)
	-- | List of addresses where LOCK prefix is used so that they can
	--   be replaced by NOP on single processor machines.
    , _lockPreTbl :: Word32
    , _maxAllocSz :: Word32				-- ^ Maximum Allocation Size (Bytes)
    , _virtMemThreshd :: Word32			-- ^ Maximum Virtual Memory Size (Bytes)
	-- | This set as non-zero is like calling @SetProcessAffinityMask@ during 
	--   startup (.exe only)
    , _procAffinityMask :: Word32
	-- | Flags which correspond to the first argument of @HeapCreate@ which 
	--   are created during process startup.
    , _procHeapFlags :: Word32
    , _cSDVersion :: Word16				-- ^ Service Pack version identifier
    , _reserved1 :: Word16				-- ^ Must be zero
    , _editList :: Word32				-- ^ Reserved for use by system
    , _securityCookie :: Word32		    -- ^ ptr to a cookie used by Visual C++
	-- | Virtual Address of the sorted table of RVAs of each Structured
	--   Exception Handler in the image
    , _sEHandlerTbl :: Word32
	-- | Total count of unique SEHs in the table
    , _sEHandlerCnt :: Word32
    } deriving (Show, Eq, Ord)
\end{code}
